package com.mida.dms.knw.api;

import com.mida.dms.knw.entity.vo.KnwIndividualRelationVo;
import com.mida.dms.knw.entity.vo.KnwIndividualVo;
import com.mida.dms.knw.entity.vo.MapperPage;
import com.mida.dms.knw.vo.KnwIndividualRelationPageVo;
import com.mida.dms.knw.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <h1>实例关系</h1>
 * <p>
 *
 * </p>
 *
 * @author jian.li on 2021/7/15 15:12
 */
@DependsOn("loadFromDatabasePropertyConfig")
@FeignClient(name = "KnwIndividualRelationApi", url = "dms.knw.feign.url")
public interface KnwIndividualRelationApi {

    @ApiOperation(value = "新增单条实例关系", notes = "新增单条实例关系")
    @PostMapping(value = "/knwIndividualRelation/addRelation", consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult addSingle(@RequestBody KnwIndividualRelationVo relation);

    @ApiOperation(value = "批量新增实例关系", notes = "批量新增实例关系")
    @PostMapping(value = "/knwIndividualRelation/addRelationList", consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult addList(@RequestBody List<KnwIndividualRelationVo> relationList);

    @ApiOperation(value = "分页查询实例关系", notes = "分页查询实例关系")
    @PostMapping(value = "/knwIndividualRelation/findPage", consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<PageResultVo<KnwIndividualRelationVo>> findPage(@RequestBody KnwIndividualRelationPageVo vo);

    @ApiOperation(value = "编辑实例关系", notes = "编辑实例关系")
    @PostMapping(value = "/knwIndividualRelation/updateRelation", consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult updateSingle(@RequestBody KnwIndividualRelationVo relation);

    @ApiOperation(value = "删除实例关系", notes = "删除实例关系")
    @GetMapping(value = "/knwIndividualRelation/delete", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ActionResult delete(@RequestParam("soid") Long individualRelationSoid);

    @ApiOperation(value = "根据实例关系soid查询实例关系", notes = "根据实例关系soid查询实例关系")
    @GetMapping(value = "/knwIndividualRelation/findSingle", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<KnwIndividualRelationVo> findSingle(@RequestParam("soid") Long individualRelationSoid);

    @ApiOperation(value = "启用实例关系", notes = "启用实例关系")
    @GetMapping(value = "/knwIndividualRelation/enable", produces = {"application/json;charset=UTF-8"})
    ActionResult enable(@RequestParam("soid") Long soid);

    @ApiOperation(value = "源实例目标实例下拉", notes = "源实例目标实例下拉")
    @PostMapping(value = "/knwIndividualRelation/findSourceAndTarget", consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<List<KnwIndividualVo>> findSourceAndTarget(@RequestBody MapperPage page);

    @ApiOperation(value = "实例关系下拉", notes = "实例关系下拉")
    @GetMapping(value = "/knwIndividualRelation/findRelation", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    ListResult<Object> findRelation(@RequestParam("searchData") String searchData);
}
